import random

current = random.randint(1,128)

import tkinter as tk


from tkinter import *
from tkinter import ttk

window = Tk() #Создаём окно приложения.
window.title("Угадайка")
window.geometry('400x300')

lb = ttk.Label(window, text="Введите число:")
lb.pack()

spinbox = ttk.Spinbox(window, from_=1.0, to=128.0)
spinbox.pack()

def click_button():
    value = spinbox.get()
    if value.isdigit():
        num = int(value)
        if current > num:
            answer['text'] = "Загаданное число больше"
        elif current < num:
            answer['text'] = "Загаданное число меньше"
        else:
            answer['text'] = "Вы угадали"
    else:
        answer['text'] = "Введено не число"

btn = ttk.Button(window, text="Enter", command=click_button)
btn.pack()

answer = ttk.Label(window, text="")
answer.pack()

window.mainloop()
